package com.mpyy.handler.purchase;

import com.mpyy.dao.ToolInter;
import com.mpyy.pojo.ProductUnit;
import com.mpyy.service.purchase.UpdateProUnitServiceInter;
import com.mpyy.tool.Tool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @version 1.0
 * @Descoription updateProUnitHandler
 * @Author CG
 * @date 2022-03-23
 */
@Controller
public class updateProUnitHandler {
    @Autowired
    @Qualifier(value = "updateProUnitServiceImpl")
    private UpdateProUnitServiceInter unitServiceInter;
    @Autowired
    private ToolInter toolInter;

    @RequestMapping(value = "/updateProUnit")
    @ResponseBody
    public String updateProUnit(ProductUnit productUnit){
        productUnit.setUnitId(new Tool().aotomaticId(productUnit.getUnitId(),toolInter));

      int row = unitServiceInter.updateProUnit(productUnit);


     return String.valueOf(productUnit.getUnitId());
    }

}
